import { Inject, Controller ,Post ,Body, UseGuard} from '@midwayjs/decorator';
import { Context } from '@midwayjs/koa'
import { Role } from 'src/decorator/role.decorator';
// import { AdminMiddleware } from 'src/middleware/adminiogin ';
import { AdminService } from 'src/service/admin.service';
import { AuthGuard } from '../../guard/auth.guard'
/**
 * 描述
 */
 @UseGuard(AuthGuard)
@Controller('/admin' )
export class API2Controller {
 @Inject()
  ctx: Context;
 @Inject()
 AdminService:AdminService

//  返回 7天的浏览量 订单量 
//  今日成交金额  交易数量 浏览量      用户量总数 代理总数
@Role(['admin','agent'])
@Post('/geweek')
async geweek( @Body() body) {
        return  this.AdminService.sevrenday(body?.num)
  }

@Role(['admin','agent'])
@Post('/today')
async today( @Body() body) {
        return  this.AdminService.today()
  }
// @Role(['admin','agent'])
@Post('/getuserinfo')
async getuserinfo( @Body() body) {
        return  this.AdminService.getuserinfo()
  }


}